from rest_framework import serializers

from goods.models import SpecificationOption, SPUSpecification



# 商品SPU规格
class SPUSpecificationSerializer(serializers.ModelSerializer):

    class Meta:
        model = SPUSpecification
        fields = ('id','name')

# 规格表
class specificationoptionserializer(serializers.ModelSerializer):

    # option = SPUSpecificationSerializer()

    spec = serializers.StringRelatedField(read_only=True)
    spec_id = serializers.IntegerField()
    class Meta:
        model = SpecificationOption
        fields = ('id','value','spec','spec_id')